package com.gaoyang.service;

import com.gaoyang.domain.DianPingUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GonghuiUserService {

	private static String PRODUCT_GONGHUI_USER_COLLECTION = "gonghui_user";

	@Autowired
    MongoTemplate mongoTemplate;

	public List<DianPingUser> getGonghuiListExecute() {
		return mongoTemplate.find(new Query(Criteria.where("isExecute").is("1")), DianPingUser.class, PRODUCT_GONGHUI_USER_COLLECTION);
	}

	public DianPingUser findUserByUserName(String userName) {
		return mongoTemplate.findOne(new Query(Criteria.where("userName").is(userName)), DianPingUser.class, PRODUCT_GONGHUI_USER_COLLECTION);
	}


}